Skip to content

security: CWE-295: warn on TLS verify=False, fix insecure examples — VC-53768#195

Open
SahilWikhe-sw wants to merge 1 commit into
Venafi:masterfrom
SahilWikhe-sw:VC-53768-logos-fix-c
Open

security: CWE-295: warn on TLS verify=False, fix insecure examples — VC-53768#195
SahilWikhe-sw wants to merge 1 commit into
Venafi:masterfrom
SahilWikhe-sw:VC-53768-logos-fix-c

Conversation

@SahilWikhe-sw
Copy link
Copy Markdown

Summary

  • Add runtime log.warning in TPPConnection, TPPTokenConnection, and CloudConnection constructors when http_request_kwargs['verify'] is False
  • Flip four shipped examples so the CA-bundle path (verify="/path-to/bundle.pem") is the active line and verify=False is relegated to a clearly-labelled lab-only comment

Finding

CWE-295 (Improper Certificate Validation) / CWE-1188 (Insecure Default)

All three connection classes (connection_tpp.py, connection_tpp_token.py, connection_cloud.py) splatted **self._http_request_kwargs into every requests call with no guard on the verify key. Four shipped examples (examples/get_cert.py, examples/tpp/get_cert_tpp_token.py, examples/ssh_certificates/get_cert_ssh.py, examples/ssh_certificates/get_cert_ssh_service.py) set verify=False as the active code path, so consumers copying them verbatim sent Venafi credentials, session tokens, and private-key material over TLS sessions with no server-certificate validation.

Remediation

  • SDK guard (detective): After the timeout normalisation block in each constructor, check http_request_kwargs.get('verify') is False and emit a WARNING-level log message. Uses is False so CA-bundle strings and the absent-key default (None) are not flagged.
  • Example flip: The trust-bundle variant is now the live line; verify=False is moved to a # Lab/testing only — DO NOT use in production comment.

Verification

  • 7 files changed: 3 SDK sources + 4 examples
  • python -m py_compile passes on all modified files
  • Warning guard: http_request_kwargs.get('verify') is False is branch-free and evaluated immediately after the dict is guaranteed non-None
  • No new imports, no API signature changes
  • Pre-existing test failures (ModuleNotFoundError: No module named 'six') are an unrelated environment issue unaffected by this change

@SahilWikhe-sw SahilWikhe-sw force-pushed the VC-53768-logos-fix-c branch from 9033630 to 3a4a8be Compare June 3, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant